<route lang="json5">
{
  style: {
    navigationStyle: 'default',
    navigationBarTitleText: '我的资料',
  },
}
</route>

<template>
  <view class="content-warp">
    <view class="content">
      <wd-cell title="姓名" :value="userInfo.name" />
      <wd-cell title="手机号" :value="userInfo.mobile" />
      <wd-cell title="地址" :value="userInfo.address" />
    </view>
    <buttonBtn @btnClick="toUpdate">
      <view>修改资料</view>
    </buttonBtn>
  </view>
</template>

<script setup lang="ts">
import { userInformation } from '@/service/user'

function toUpdate() {
  uni.navigateTo({
    url: '/pages/user/updateInfo/index',
  })
}
// 用户信息
const userInfo = ref<IUserInfo>({})
const getUserInfo = async () => {
  const res: IResData<IUserInfo> = await userInformation()
  if (res.code === 1) {
    userInfo.value = res.data
  }
}
onLoad(async () => {
  await getUserInfo()
})
</script>

<style scoped lang="scss">
.content-warp {
  background-color: #f4f4f4;
  padding: 15px;
  height: 100%;
  min-height: 95vh;
  .content {
    border-radius: 10px;
    padding: 15px;
    background-color: #fff;
  }
}
.custom-shadow {
  border-radius: 12px;
}

::v-deep {
  .wd-cell {
    padding-left: 0px !important;
    border-bottom: 1px solid #f7f7f7;
    .wd-cell__wrapper {
      padding-right: 0px !important;
    }
    .wd-cell__value {
      text-wrap: nowrap;
    }
  }
}
</style>
